#syntax=docker/dockerfile:1
FROM openjdk:17-jdk-alpine
ARG JAR_FILE
ENV APP_DIR=/app \
    JAVA_OPTS="" \
    PROFILE=dev

WORKDIR $APP_DIR
RUN apk add --no-cache bash
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
RUN echo 'Asia/Shanghai' >/etc/timezone
# 字体
COPY fonts/simsun.ttc /usr/share/fonts/simsun.ttc

COPY ${JAR_FILE} app.jar

ENV JAVA_OPTS="-Dspring.profiles.active=$PROFILE -Dfile.encoding=UTF-8 -Xms512M -Xmx512M -XX:+HeapDumpOnOutOfMemoryError"

EXPOSE 8081

ENTRYPOINT ["sh", "-c", "java $JAVA_OPTS -jar app.jar"]
